from easygui import enterbox,msgbox
import socket

title = "海大竞赛订阅客户端"
mail_status = 0
while 1:
    mail = enterbox("请输入您需要注册所需的电子邮件：",title)
    if "@" not in mail or "." not in mail and mail != "":
        msgbox("不符合电子邮件要求！请重新输入！")
    else:
        mail_status = 1
        break

if mail_status:
    s = socket.socket(socket.AF_INET,socket.SOCK_STREAM)

    s.connect(('119.23.200.31',39105))
    s.send(b'names')
    print(s.recv(1024).decode('utf-8'))
    data = mail.encode('utf-8')
    s.send(data)
    print(s.recv(1024).decode('utf-8'))
    s.close()
    msgbox("注册成功！")

